﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CentaLine.Infrastructure;
using CentaLine.Model;
using CentaLine.Repository;
using NUnit.Framework;

namespace NunitTest
{
    [TestFixture]
    public class VitualPhoneManagerTest
    {
        VitualPhoneManager VitualPhoneManager = new VitualPhoneManager();
        DirectorManager directorManager = new DirectorManager();
        [Test]
        public void AutoAssignTest()
        {
            //VitualPhoneManager.AutoAssign();
            //获取所有区董信息
            List<Director> directorList = directorManager.GetDirectorInfoListWithVP().ToList();
            //处理和每位区董挂钩的申请信息
            directorList.ForEach(d => VitualPhoneManager.AssignForSingleDirector(DateTime.Now, d));
        }

        [Test]
        public void GetCounselorApplicationByIdTest()
        {
            CounselorApplication model = VitualPhoneManager.GetCounselorApplicationById(3);
            Assert.AreEqual(model.Org_Name, "锦绣华城四店二组");
        }

        // 数据初始化操作相关
        [Test]
        public void InitalVPStatusOfDirectorsTest()
        {
            VitualPhoneManager.InitalVPStatusOfDirectors();
        }

        // 数据初始化操作相关
        [Test]
        public void InitalRemoteVitualPhoneTest()
        {
            VitualPhoneManager.InitalRemoteVitualPhone(DateTime.Now);
        }

        [Test]
        public void AsyncCounselorApplicationListTest()
        {
            var res = VitualPhoneManager.AsyncCounselorApplicationList(DateTime.Now);
            Assert.True(res);
        }

        //InitCounselorApplicationList


        [Test]
        public void BackUpdialnumber()
        {
            VitualPhoneManager.BackUpdialnumber();
        }
        [Test]
        public void Restoredialnumber()
        {
            VitualPhoneManager.Restoredialnumber(DateTime.Parse("2013-09-29 13:41:53.127"));
        }
        [Test]
        public void SingleAssign()
        {
            //VitualPhoneManager.SingleAssign("AA40181", "2013年9月", "18221647820", new PhoneKind(1, "安居客"));
        }//GetBackUpInfoList

        [Test]
        public void GetBackUpInfoList()
        {
            VitualPhoneManager.GetBackUpInfoList();
        }

        [Test]
        public void IsAssignedTest()
        {
            var c = VitualPhoneManager.GetCounselorApplicationById(298430);
            var res = VitualPhoneManager.IsAssigned(c);
            Assert.AreEqual(res.Result, true);
        }

        [Test]
        public void AddVitualPhoneTest()
        {
            var res = VitualPhoneManager.AddVitualPhone("测试总监", "testId", "10086" + new Random().Next(100), "0");
        }
        [Test]
        public void BackUpdVitualPhoneTest()
        {
            var res = VitualPhoneManager.BackUpdVitualPhone();
        }

        [Test]
        public void LogErrorTest()
        {
            Logger.LogDB.Error("异常日志测试");
        }

         
    }
}
